﻿<%@ WebHandler Language="C#" Class="GetLinkman" %>

using System;
using System.Web;
using TSqlServer;

public class GetLinkman : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {

        string linkmanid = context.Request["lmid"].ToString();

        string linkman = "";
        string sSql = "select * from t_linkman where uid='" + linkmanid + "'";
        TSqlDBReader myReader = new TSqlDBReader(sSql);
        if (myReader.FDataReader.Read())
        {
            linkman += "{";

            linkman += "\"name\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("linkman")).ToString() + "\",";
            linkman += "\"implevel\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("implevel")).ToString().Trim() + "\",";
            linkman += "\"srvcompany\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("srvcompany")).ToString().Trim() + "\",";
            linkman += "\"sex\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("sex")).ToString().Trim() + "\",";
            linkman += "\"companyabb\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("companyabb")).ToString() + "\",";
            linkman += "\"company\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("company")).ToString() + "\",";
            linkman += "\"dept\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("dept")).ToString() + "\",";
            linkman += "\"jobposi\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("jobposi")).ToString() + "\",";
            linkman += "\"unittype\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("unittype")).ToString().Trim() + "\",";
            linkman += "\"age\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("age")).ToString() + "\",";
            linkman += "\"birthday\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("birthday")).ToString() + "\",";
            linkman += "\"email\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("email")).ToString() + "\",";
            linkman += "\"mobile\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("mobile")).ToString() + "\",";
            linkman += "\"tel\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("tel")).ToString() + "\",";
            linkman += "\"fax\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("fax")).ToString() + "\",";
            linkman += "\"companyaddr\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("companyaddr")).ToString() + "\",";
            linkman += "\"companypostcode\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("companypostcode")).ToString() + "\",";
            linkman += "\"favr\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("favr")).ToString() + "\",";
            linkman += "\"notice\":\"" + myReader.FDataReader.GetValue(myReader.FDataReader.GetOrdinal("notice")).ToString() + "\"";
            
            linkman += "}";
        }
        myReader.Free();

        context.Response.ContentType = "text/plain";
        context.Response.Write(linkman);
        context.Response.End();
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}